Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FIX: support [code] in blockquotes #26182

Merged
merged 1 commit into from Mar 14, 2024
Merged

Conversation

ZogStriP
Copy link
Member

[code]
line1
line2
[/code]

would render as

| line1
| > line2

instead of the correct

| line1
| line2

That was due to the bbcode-block code using a slice to get the content of a block and not taking into account it being nested in a quote block for example.

The fix was to get the content using the getLines utils method.

Context: https://meta.discourse.org/t/markdown-bbcode-code-quote-bug/299047

> [code]
> line1
> line2
> [/code]

would render as

| line1
| > line2

instead of the correct

| line1
| line2

That was due to the `bbcode-block` code using a `slice` to get the content of a block and not taking into account it being nested in a quote block for example.

The fix was to get the content using the `getLines` utils method.

Context: https://meta.discourse.org/t/markdown-bbcode-code-quote-bug/299047
state.bMarks[startLine + 1],
state.eMarks[nextLine - 1]
);
content = state.getLines(startLine + 1, nextLine, 0, false);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line is the actual bug fix. Doing a start.src.slice was not taking into account being nested inside a block quote for example (which prepends a > on every line).

The getLines function does all the heavy lifting for us 👏

@discoursebot
Copy link

This pull request has been mentioned on Discourse Meta. There might be relevant details there:

https://meta.discourse.org/t/markdown-bbcode-code-quote-bug/299047/9

@ZogStriP ZogStriP merged commit 5213bba into main Mar 14, 2024
16 checks passed
@ZogStriP ZogStriP deleted the fix-quoted-bbcode-code-blocks branch March 14, 2024 18:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants